/**
 *@author Sun Feiyue(Asfya)
*/
package com.ass.view;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class PageUtil {
	public static final String PHONE_NO_PATTERN="\\d{1}(-?\\d){0,10}";
	public static final String EMAIL_ADDRESS_PATTERN="^[a-zA-Z]([\\w\\.-_]*[a-zA-Z0-9])?@[a-zA-Z0-9]([\\w\\.-_]*[a-zA-Z0-9])?\\.[\\w]+";

	public static boolean isPhoneNumberValid(String number){
		Pattern pattern=Pattern.compile(PHONE_NO_PATTERN);
		Matcher match=pattern.matcher(number);
		return match.matches();
	}
	
	public static boolean isEmailAddressValid(String address){
		Pattern pattern=Pattern.compile(EMAIL_ADDRESS_PATTERN);
		Matcher match=pattern.matcher(address);
		return match.matches();
	}
	
	
}
